package com.yowasa.xiuxian.engine.battle.enemy.strategy;

import com.google.common.collect.Lists;
import com.yowasa.xiuxian.annoations.BS;
import com.yowasa.xiuxian.constant.XiuxianConstants;
import com.yowasa.xiuxian.engine.battle.strategy.BaseSpellStrategy;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ElementEnum;
import com.yowasa.xiuxian.exception.HandlerException;
import com.yowasa.xiuxian.service.helper.BattleHelper;
import com.yowasa.xiuxian.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@BS(name = "深渊法师")
@Order(1006)
@Component
public class ShenYuanFaShi extends BaseSpellStrategy {
    @Autowired
    private BattleHelper battleHelper;

    @Override
    public ElementEnum getElement() {
        return null;
    }

    @Override
    public void action(UserBattleContent first, UserBattleContent second, BattleContent content) {
        int dmg;
        String desc;


        int orgAtk = first.getBattleInfo().getSpell();
        int def = second.getBattleInfo().getRes();
        int atk = (int) (orgAtk * 1.3);
        dmg = battleHelper.calAtk(atk, def);
        //user.getElement().get("土") < XiuxianConstants.DEFAULT_ELEMENT_ACTIVITY
        if(first.getUserBO().getElement().get("火") > XiuxianConstants.DEFAULT_ELEMENT_ACTIVITY){
            desc = RandomUtil.choice(Lists.newArrayList("烈焰舞轮","火焰放射","重塑仪式","火焰闪烁"));
        }else if(first.getUserBO().getElement().get("水") > XiuxianConstants.DEFAULT_ELEMENT_ACTIVITY){
            desc = RandomUtil.choice(Lists.newArrayList("水弹","水泡泡","下落冰柱","冰锥攻击"));
        }else if(first.getUserBO().getElement().get("金") > XiuxianConstants.DEFAULT_ELEMENT_ACTIVITY){
            desc = RandomUtil.choice(Lists.newArrayList("闪电球","磁暴线圈","瞬雷闪","雷脉光球","闪雷重铸"));
        }else {
            desc = RandomUtil.choice(Lists.newArrayList("元素舞轮","元素放射","深渊祭礼","深渊咒术"));

        }

        battleHelper.autoAction(this, first, second, content, dmg, desc);
    }

    @Override
    public void limit(UserBO user) {
        throw new HandlerException("无法学习妖兽的攻击手段");
    }

    @Override
    public String limitDesc() {
        return "无";
    }

    @Override
    public String desc() {
        return  "拥有魔力，利用元素战斗的深渊魔物。\n" +
                "出于某种不为人知的缘由，深渊法师精通丘丘人的笨拙语言，能驾驭它们的心智。\n据说深渊法师略通如今几乎无人可解的失落古语，并利用这种语言的力量行使魔法。 \n" +
                "擅长法术攻击,不同的元素沾染会拥有不同的技能组\n 元素舞轮,元素放射,深渊祭礼\n" +
                "出没地点：\t苍风高地，风龙废墟，荻花洲" ;
    }


}
